import * as types from '../types'
import api from 'api/api'
import common from "api/common";

const state={
  token:common.getVal('token',null)||'',
  userInfo:common.getVal('userInfo',null)||'',
  operatePwd:'',
  btnState:false
}

const getters={
  token:state=>state.token,
  userInfo:state=>state.userInfo,
  operatePwd:state=>state.operatePwd,
  btnState:state=>state.btnState,
}

const mutations={
  [types.SET_USER_TOKEN](state,res){
    common.setVal('token', res)
    state.token=res
  },
  [types.SET_USER_INFO](state,res){
    common.setVal('userInfo', res)
    state.userInfo=res
  },
  [types.SET_USER_PWD](state,res){
    state.operatePwd=res
  },
  [types.SET_BTN_STATE](state,res){
    state.btnState=res
  }
}

const actions={}

export default {
  namespaced:true,
  state,
  getters,
  actions,
  mutations
}
